﻿<Gadgets:GadgetBase x:Class="Epi.WPF.Dashboard.Gadgets.Analysis.FrequencyControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Gadgets="clr-namespace:Epi.WPF.Dashboard.Gadgets"
    xmlns:Dashboard="clr-namespace:Epi.WPF.Dashboard"
    xmlns:Controls="clr-namespace:Epi.WPF.Dashboard.Controls"
    Style="{DynamicResource gadgetBaseStyle}">
    <Gadgets:GadgetBase.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="..\..\ResourceDictionary.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Gadgets:GadgetBase.Resources>
    <Grid>
        <!--<Controls:ShadowRectangle x:Name="rectangleShadow"></Controls:ShadowRectangle>-->
        <Border Name="borderAll" Style="{DynamicResource mainGadgetBorder}" >
            <Border.ContextMenu>
                <ContextMenu x:Name="gadgetContextMenu">
                    <MenuItem x:Name="mnuCopy" Header="Copy data to clipboard"/>
                    <MenuItem x:Name="mnuSendDataToHTML" Header="Send data to web browser">
                        <MenuItem.Icon>
                            <Image Source="../../Images/saveHTML.png" />
                        </MenuItem.Icon>
                    </MenuItem>
                    <MenuItem x:Name="mnuSendDataToExcel" Header="Send data to Excel" />
                    <Separator/>
                    <MenuItem x:Name="mnuSendToBack" Header="Send gadget to back"/>
                    <MenuItem x:Name="mnuClose" Header="Close this gadget"/>
                </ContextMenu>
            </Border.ContextMenu>

            <Grid x:Name="grdMain">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="6" />
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="6" />
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="6" />
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="*"></RowDefinition>
                </Grid.RowDefinitions>
                <Controls:GadgetHeaderPanel x:Name="headerPanel" Grid.Row="0" Text="Frequency" />
                <Controls:GadgetMessagePanel Margin="5" x:Name="messagePanel" Grid.Row="2" Text="" />
                <Controls:GadgetDescriptionPanel Grid.Row="4" PanelMode="Collapsed" x:Name="descriptionPanel"></Controls:GadgetDescriptionPanel>

                <!--<TextBlock Grid.Row="6" x:Name="txtFilterString" Style="{DynamicResource filterStringText}" Visibility="Collapsed" >
                </TextBlock>-->

                <Controls:GadgetInfoPanel Grid.Row="4" Visibility="Collapsed" Margin="5" x:Name="infoPanel"></Controls:GadgetInfoPanel>

                <StackPanel Grid.Row="7" x:Name="panelMain" HorizontalAlignment="Left" VerticalAlignment="Top"></StackPanel>

                <Controls:GadgetWaitPanel x:Name="waitPanel" Visibility="Collapsed" Grid.Row="1" Grid.RowSpan="6" Style="{DynamicResource gadgetWaitPanelStyle}" />

                <!--<StackPanel x:Name="panelMain" HorizontalAlignment="Left" VerticalAlignment="Top">-->
        <!--</StackPanel>-->                
                
                    <StackPanel Grid.Row="1" Grid.RowSpan="7" Margin="00,-15,-10,0"  HorizontalAlignment="Right" VerticalAlignment="Top" >
                    <Grid x:Name="ConfigGrid" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,15,10,0" >
                        <Rectangle Style="{DynamicResource rectangleConfigOuter}" />
                        <Rectangle Style="{DynamicResource rectangleConfigInner}" />

                        <Path x:Name="pathTriangle" 
                              Margin="0,-2,68,0"
                              Data="M 5 0 L 10 10 0 10 Z" Fill="{DynamicResource gadgetBackgroundBrush}" IsHitTestVisible="False" HorizontalAlignment="Right" VerticalAlignment="Top" Height="7" />
                        
                <StackPanel Orientation="Vertical" Margin="25, 10, 25, 25" HorizontalAlignment="Center" VerticalAlignment="Top" >
                            <TextBlock x:Name="ConfigExpandedTitle" HorizontalAlignment="Center" TextAlignment="Center" Text="Frequency Properties" Margin="5" FontWeight="Bold" />
                            <TextBlock x:Name="tblockMainVariable" HorizontalAlignment="Left" TextAlignment="Center" Text="Frequency of:" Margin="0,5,0,0"  />
                            <ComboBox x:Name="cbxField" Width="140" HorizontalAlignment="Left" SelectedIndex="0" />

                            <Grid x:Name="grdAdvancedOptionsHeading">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                                </Grid.ColumnDefinitions>
                            </Grid>

                            <Expander Margin="0, 5, 0, 0" x:Name="expanderAdvancedOptions" Header="Advanced options">
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition></ColumnDefinition>
                                        <ColumnDefinition Width="15"></ColumnDefinition>
                                        <ColumnDefinition></ColumnDefinition>
                                        <ColumnDefinition Width="15"></ColumnDefinition>
                                        <ColumnDefinition></ColumnDefinition>
                                    </Grid.ColumnDefinitions>
                                    <StackPanel x:Name="panelAdvanced1" Visibility="Visible">
                                        <TextBlock x:Name="tblockWeightVariable" HorizontalAlignment="Left" TextAlignment="Center" Text="Weight:" Margin="0,5,0,0"  />
                                        <ComboBox x:Name="cbxFieldWeight" Width="140" HorizontalAlignment="Left" SelectedIndex="0" />
                                        <TextBlock x:Name="tblockStrataVariable" HorizontalAlignment="Left" TextAlignment="Center" Text="Stratify by:" Margin="0,5,0,0"  />
                                        <ComboBox x:Name="cbxFieldStrata" Width="140" HorizontalAlignment="Left" SelectedIndex="0" />                                                                    
                                        <!--<TextBlock x:Name="tblockMaxRowsLabel" HorizontalAlignment="Left" TextAlignment="Center" Text="Max rows to display:" Margin="0,5,0,0"  />-->
                                        <!--<StackPanel Orientation="Horizontal">
                                            <TextBox x:Name="txtMaxRows" Width="60" Text="200" Margin="0, 0, 0, 0" PreviewTextInput="txtMaxRows_PreviewTextInput"></TextBox>
                                            <Controls:GadgetRefreshIcon MouseLeftButtonUp="GadgetRefreshIcon_MouseLeftButtonUp"></Controls:GadgetRefreshIcon>
                                        </StackPanel>-->
                                    </StackPanel>

                                    <StackPanel Grid.Column="2" x:Name="panelAdvanced2" Visibility="Visible">
                                        <CheckBox x:Name="checkboxAllValues" Margin="0,5,0,0" Content="Display all list values"  HorizontalAlignment="Left" IsEnabled="false"/>
                                        <CheckBox x:Name="checkboxCommentLegalLabels" Margin="0,5,0,0" Content="Display list labels"  HorizontalAlignment="Left" IsEnabled="false"/>
                                        <CheckBox x:Name="checkboxSortHighLow" Margin="0,5,0,0" Content="Sort high to low" HorizontalAlignment="Left" />                                        
                                        <CheckBox x:Name="checkboxIncludeMissing" Margin="0,5,0,0" Content="Include missing values" HorizontalAlignment="Left" IsChecked="False" />
                                        <CheckBox x:Name="checkboxUsePrompts" Margin="0,5,0,0" Content="Use field prompt" Grid.Row="8" Grid.Column="2" IsChecked="True" Visibility="Visible" IsEnabled="true" />
                                    </StackPanel>

                                    <StackPanel Grid.Column="4"  x:Name="panelAdvanced3" Visibility="Visible">
                                        <TextBlock x:Name="tblockOutputColumns" Margin="0,5,0,0" >Output columns to display:</TextBlock>
                                        <ListBox x:Name="lbxColumns" SelectionMode="Multiple" SelectionChanged="lbxColumns_SelectionChanged">
                                            
                                        </ListBox>
                                    </StackPanel>
                                </Grid>
                            </Expander>

                        </StackPanel>
            </Grid>
        </StackPanel>                
            </Grid>
        </Border>
    </Grid>
</Gadgets:GadgetBase>
